/*
	This head file contains link_list function mainly.
*/
#ifndef _LIST_APP_H_
#define _LIST_APP_H_
#include "kernel_list.h"
#include <stdlib.h>

struct st_client						//the substance of the promgram data (customizable)
{
	char client_name[20];				// client name

};

typedef struct node			// Linknode carry the substance
{
	struct st_client info;       
	struct list_head list;
}linknode, *linknode_p;


static inline linknode * request_list_head(void)
{
	linknode * head;

	head = malloc(sizeof(linknode));
	if(head == NULL)
	{
		return NULL;
	}

	INIT_LIST_HEAD(&(head->list));

	return head;
}

static inline linknode * new_node(void)
{
	linknode * node;

	node = malloc(sizeof(linknode));
	if(node == NULL)
	{
		return NULL;
	}
	INIT_LIST_HEAD(&(node->list));

	return node;
}

static inline void insert_node_to_list(linknode * head, linknode * node)
{
	list_add(&node->list, &head->list);
}

int remove_node_in_list(linknode * head, const char* client);
void destory_list(linknode * head);




int print_list(linknode * head);
int remove_node_in_list(linknode *head, const char* client);

#endif
